'\" t
'
' Name:		tpchk.1m
'
' Completed:	15th August, 2003.
'
' Updated:	
'
' Purpose:	Describes the tpchk command.
'
' Author:	Simon Edwards, Proprius Consulting Ltd.
'
' Version:	@(#)1.1 Original (SE)
'
.TH tplist 1M "26 December 2003" "Linuxha.net"

.SH NAME
tpchk - Check installed packages

.SH SYNOPSIS
.TS
l l.
tpchk [\fB-p\fP \fIpkg\fP] [\fB-v\fP]s\fP]	- Check installed packages
.TE

.SH DESCRIPTION
The \fItpchk(1M)\fP utility is used to check to see if if all or specified
packages are still installed correctly. Without any arguments all installed 
and committed packages in the current installed package database are
checked. 

More information is available describing the Tarp packagement management
facilities can be found in the \fItpintro(1M)\fP manual page.

When this utility is run it will take either all or the named packages
and check to see if they are still "valid". Checks are made to ensure that
all installed files still exist, and that the file contents have not been
changed.

At present the utility does not attempt to validate the time stamps,
owner, group or permissions - though it is likely these facilities will
be implemented later on.

.SH ARGUMENTS
Currently one two command line arguments are supported, and both are optional.

.TP 4
.B -p
This argument is followed by the name of a package, or a pattern matching
multiple packages. It limits the package checking to those packages that
match.

If no packages match the name or pattern given an error will be given. If
this argument is not given on the command line then all installed packages
will be checked.
.TP
.B -v
Verbose mode - shows progress messages as the script executes. This shows 
details of each package checked, including the number of files valid, invalid
and removed.

.SH EXAMPLES
The first example checks all products that are installed in a
users installed package database defined as "/home/sedwards/tarpdb":

.TS
l.
$ TARP_DB=$HOME/tarp; export TARP_DB
$ tpchk
.TE

In this case if there are any problems, only very basic output will be
given:

.TS
l.
ERROR: 1 file has changed in package healthcheck
ERROR: 1 error was found.
.TE

As you can see the information given is very basic - it does identify
which packages and how many files in an affected package are invalid, but
no details are given about the actual problems.

The second example shows using the verbose argument \fB-v\fP to show
more details of any problems found:

.TS
l.
$ tpchk -v
.TE

The output in this case, (using a small installed package database containing
just two packages):

.TS
l.
INFO : Checking package functions
INFO : 63 files are still valid in package functions
INFO : Checking package healthcheck
INFO : File /home/sedwards/install/sbin/init.d/hcserverd has been changed
ERROR: 1 file has changed in package healthcheck
INFO : 183 files are still valid in package healthcheck
INFO : 
INFO : A total of 247 files were checked in 2 packages.
INFO : 
ERROR: 1 error was found.
.TE

In this case the details of each file with a problem are shown, as well
as the names of the packages checked, and how many files in each package
currently remain valid.

The final example shows how just a particular package in the default
installed package database can be checked.

.TS
l.
$ TARP_DB=""; export TARP_DB
$ tpchk -p healthcheck -v
.TE

We remove the value of the TARP_DB environment variable, (it was set during the
first example), to ensure the default installed package database,
"/var/adm/tarpdb" is referenced for the required package information.

.SH EXIT CODES
The utility makes use of the following exit codes:

.TP 4
.B 0
All packages checked were valid.
.TP
.B 1
Invalid command line arguments have been specified - a usage message will
have been shown on standard errror.
.TP
.B 2
One or more of the packages checked is no longer valid, (use the verbose
option to get more details).
.TP
.B 9
The installed package database specified, (either "/var/adm/tarpdb" or the
value referred to in \fBTARP_DB\fP), does not reference a valid installed
package database.
.TP
.B 10
A non-zeo return code was generated by the "preremove" script and the force
flag (\fB-f\fP) was not specified.

.SH FILES
When examining information from an installed package database the following
files for each package are referenced:

.TP 8
.B rootdir
Contains the root directory that was used for the package installation.
.TP
.B status
The state of each package to examine - if it is not in "installed" or
"committed" status the package will be ignored.
.TP
.B cksums
This file contains a list of all the installed files - and the cksum for
each file.

.SH SEE ALSO
.BR tpintro(1M),
.BR tpinstall(1M),
.BR tplist(1M),
.BR tppkg(1M).

.SH WARRANTY/LICENSE/ENVIRONMENT
This utility is available under the GNU GPL, and comes with 
\fIno warranty or guarantee of any kind\fP.

This program is only suitable for environments that have the following
software components installed:

.TP 4
.B Shell Utilities
The following utilities are required, \fIawk(1)\fP, \fIksh(1)\fP
as well as the standard utiltiies to check, move and remove files and 
directories.
.TP
.B Perl
Any version of Perl from 4 onwards with standard installation libraries
should be suitable. Currently Perl is only used sparingly, but still must
be available.

